x86: properly handle MSI-X unmask operation from guests
authorFeng Wu <feng.wu@intel.com>
Wed, 27 Nov 2013 14:15:43 +0000 (15:15 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 27 Nov 2013 14:15:43 +0000 (15:15 +0100)
commit74fd0036deb585a139b63b26db025805ecedc37a
tree809419a9ece01e24ae1da34ff39248fe7fa55ecf
parent470f58c159410b280627c2ea7798ea12ad93bd7c
x86: properly handle MSI-X unmask operation from guests

For a pass-through device with MSI-x capability, when guest tries
to unmask the MSI-x interrupt for the passed through device, xen
doesn't clear the mask bit for MSI-x in hardware in the following
scenario, which will cause network disconnection:

1. Guest masks the MSI-x interrupt
2. Guest updates the address and data for it
3. Guest unmasks the MSI-x interrupt (This is the problematic step)

In the step #3 above, Xen doesn't handle it well. When guest tries
to unmask MSI-X interrupt, it traps to Xen, Xen just returns to Qemu
if it notices that address or data has been modified by guest before,
then Qemu will update Xen with the latest value of address/data by
hypercall. However, in this whole process, the MSI-X interrupt unmask
operation is missing, which means Xen doesn't clear the mask bit in
hardware for the MSI-X interrupt, so it remains disabled, that is why
it loses the network connection.

This patch fixes this issue.

Signed-off-by: Feng Wu <feng.wu@intel.com>
Only latch the address if the guest really is unmasking the entry.

Clean up the entire change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/io.c
xen/arch/x86/hvm/vmsi.c
xen/include/asm-x86/hvm/io.h
xen/include/asm-x86/hvm/vcpu.h